package com.maxd.utils;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class SeqUtils {

    /**
     * 生成固定22位的流水号，格式为yyyyMMddHHmmss + 8位随机数
     * @return
     */
    public static String dateSeq() {
        Date date = new Date();
        String newString = String.format("%0" + 8 + "d", (int) ((Math.random() * 9 + 1) * 10000000));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String format = sdf.format(date);
        return format + newString;
    }

    public static String traceId() {
        return UUID.randomUUID().toString().replace("-", "");
    }

}
